libxenlight: enables less than maximum vcpus
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Dec 2009 13:49:33 +0000 (13:49 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Dec 2009 13:49:33 +0000 (13:49 +0000)
Enable turning on a different amount of vcpus than
the maximum during domain creation/restore.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
tools/libxl/libxl.h
tools/libxl/libxl_dom.c

index 7a215e7d7e171993de97210c070acd8926e162a3..dd3d6dbe1eee6b99cb66e79320bb3297505cf7c7 100644 (file)
@@ -64,6 +64,7 @@ typedef struct {
     int hpet;
     int vpt_align;
     int max_vcpus;
+    int cur_vcpus;
     uint32_t max_memkb;
     uint32_t video_memkb;
     uint32_t shadow_memkb;
index 6535890368f53916fe6cfa45b34dd1b92d16cd98..aeb96d4e3c794d44a50ac29e31396168e373a6d4 100644 (file)
@@ -88,7 +88,8 @@ int build_post(struct libxl_ctx *ctx, uint32_t domid,
     ents[9] = libxl_sprintf(ctx, "%lu", state->store_mfn);
     for (i = 0; i < info->max_vcpus; i++) {
         ents[10+(i*2)]   = libxl_sprintf(ctx, "cpu/%d/availability", i);
-        ents[10+(i*2)+1] = "online";
+        ents[10+(i*2)+1] = (i && info->cur_vcpus && (i >= info->cur_vcpus))
+                            ? "offline" : "online";
     }
 
     dom_path = libxl_xs_get_dompath(ctx, domid);